<?php

use Illuminate\Support\Facades\View;
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/

/*Route::get('1', function()
{
	return  View::make('pages.home');		
});*/
//Home
Route::get('/', array('uses'=>'HomeController@showSearch'));

Route::get('result', array('uses'=>'HomeController@doSearch'));

Route::get('about', function(){ return View::make('pages.about'); });
Route::get('register', function(){ return View::make('pages.register'); });
Route::get('apply', function(){ return View::make('pages.applicant'); });

Route::get('generate', array('uses'=>'HomeController@generate'));
//BotSearch
Route::post('botsearch', array('uses'=>'PluginController@botsearch'));

//Saving
Route::get('form', function(){ return View::make('pages.form'); });
Route::post('items', array('uses' => 'HomeController@saveItem'));

//Sold
Route::post('update', array('uses'=>'HomeController@sold'));

//Details
Route::get('details/{id}/{type}', function($id,$type){

	$vend = Item::where('id',$id)->first();
	switch ($type) {
		case 'merch':
			$msg = '<div class="alert alert-success">Vendor: ' . $vend->charname . '</div>';
			break;
		case 'loc':
			$msg = '<div class="alert alert-success">Location: ' . $vend->location . '</div>';
			break;
		
		default:
			$msg = '<div class="alert alert-danger">TSK TSK TSK!</div>';
			break;
	}
	
	return View::make('pages.details')->with('info',$msg);
});